struct ListNode* partition(struct ListNode* head, int x) {
    struct ListNode vir1;
    struct ListNode vir2;
    struct ListNode* Min = &vir1;
    struct ListNode* Max = &vir2;
    struct ListNode* fmin = &vir1;
    struct ListNode* fmax = &vir2;
    struct ListNode* Find = head;
    while (Find)
    {
        if (Find->val >= x)
        {
            fmax->next = Find;
            fmax = fmax->next;
            Find = Find->next;
        }
        else
        {
            fmin->next = Find;
            fmin = fmin->next;
            Find = Find->next;
        }
    }
    fmin->next = vir2.next;
    fmax->next = NULL;

    return vir1.next;
}